/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * jFCaixa.java
 *
 * Created on 09/04/2011, 22:23:43
 */

package sgfi;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.KeyStroke;
import javax.swing.table.DefaultTableModel;
import sgfi.Classes.ClassConecta;
import sgfi.Classes.ComboItem;
import sgfi.Classes.Comunidade;
import sgfi.Classes.Contas;
import sgfi.Classes.Funcoes;
import sgfi.Classes.LivroCaixa;

/**
 *
 * @author vitiazze
 */
public class jFCaixa extends javax.swing.JFrame {

    /** Creates new form jFCaixa */
    public jFCaixa() {
        initComponents();
        JRootPane meurootpane = getRootPane();
        meurootpane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "ESCAPE");
        meurootpane.getRootPane().getActionMap().put("ESCAPE", new AbstractAction("ESCAPE") {

            public void actionPerformed(ActionEvent e) {
                setVisible(false);
            }
        });

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jToolBar1 = new javax.swing.JToolBar();
        consultarLancamentojButton = new javax.swing.JButton();
        abriCaixajButton = new javax.swing.JButton();
        depositojButton = new javax.swing.JButton();
        saquejButton = new javax.swing.JButton();
        transferenciajButton = new javax.swing.JButton();
        estornarLancjButton = new javax.swing.JButton();
        imprimirjButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        sairjButton = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        atualizarComunidadejButton = new javax.swing.JButton();
        comunidadejComboBox = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        atualizarContajButton = new javax.swing.JButton();
        contasjComboBox = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        datLancjFormattedTextField = new javax.swing.JFormattedTextField();
        jLabel1 = new javax.swing.JLabel();
        esteAnojRadioButton = new javax.swing.JRadioButton();
        esteMesjRadioButton = new javax.swing.JRadioButton();
        hojejRadioButton = new javax.swing.JRadioButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        gradeCaixajTable = new javax.swing.JTable();
        jPanel5 = new javax.swing.JPanel();
        saldoAtualjFormattedTextField = new javax.swing.JFormattedTextField();
        totaljLabel1 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        totaljLabel2 = new javax.swing.JLabel();
        saldoAnteriorjFormattedTextField = new javax.swing.JFormattedTextField();
        totaljFormattedTextField = new javax.swing.JFormattedTextField();
        jLabel4 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sgfi.SGFIApp.class).getContext().getResourceMap(jFCaixa.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jToolBar1.setRollover(true);
        jToolBar1.setName("jToolBar1"); // NOI18N

        consultarLancamentojButton.setIcon(resourceMap.getIcon("consultarLancamentojButton.icon")); // NOI18N
        consultarLancamentojButton.setText(resourceMap.getString("consultarLancamentojButton.text")); // NOI18N
        consultarLancamentojButton.setName("consultarLancamentojButton"); // NOI18N
        consultarLancamentojButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                consultarLancamentojButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(consultarLancamentojButton);

        abriCaixajButton.setIcon(resourceMap.getIcon("abriCaixajButton.icon")); // NOI18N
        abriCaixajButton.setText(resourceMap.getString("abriCaixajButton.text")); // NOI18N
        abriCaixajButton.setFocusable(false);
        abriCaixajButton.setName("abriCaixajButton"); // NOI18N
        abriCaixajButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        abriCaixajButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                abriCaixajButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(abriCaixajButton);

        depositojButton.setIcon(resourceMap.getIcon("depositojButton.icon")); // NOI18N
        depositojButton.setText(resourceMap.getString("depositojButton.text")); // NOI18N
        depositojButton.setName("depositojButton"); // NOI18N
        depositojButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                depositojButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(depositojButton);

        saquejButton.setIcon(resourceMap.getIcon("saquejButton.icon")); // NOI18N
        saquejButton.setText(resourceMap.getString("saquejButton.text")); // NOI18N
        saquejButton.setName("saquejButton"); // NOI18N
        saquejButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saquejButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(saquejButton);

        transferenciajButton.setIcon(resourceMap.getIcon("transferenciajButton.icon")); // NOI18N
        transferenciajButton.setText(resourceMap.getString("transferenciajButton.text")); // NOI18N
        transferenciajButton.setName("transferenciajButton"); // NOI18N
        transferenciajButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                transferenciajButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(transferenciajButton);

        estornarLancjButton.setIcon(resourceMap.getIcon("estornarLancjButton.icon")); // NOI18N
        estornarLancjButton.setText(resourceMap.getString("estornarLancjButton.text")); // NOI18N
        estornarLancjButton.setName("estornarLancjButton"); // NOI18N
        estornarLancjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                estornarLancjButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(estornarLancjButton);

        imprimirjButton.setIcon(resourceMap.getIcon("imprimirjButton.icon")); // NOI18N
        imprimirjButton.setText(resourceMap.getString("imprimirjButton.text")); // NOI18N
        imprimirjButton.setName("imprimirjButton"); // NOI18N
        imprimirjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                imprimirjButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(imprimirjButton);

        jSeparator1.setName("jSeparator1"); // NOI18N
        jToolBar1.add(jSeparator1);

        sairjButton.setIcon(resourceMap.getIcon("sairjButton.icon")); // NOI18N
        sairjButton.setText(resourceMap.getString("sairjButton.text")); // NOI18N
        sairjButton.setName("sairjButton"); // NOI18N
        sairjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sairjButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(sairjButton);

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel2.setForeground(resourceMap.getColor("jPanel2.foreground")); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        atualizarComunidadejButton.setIcon(resourceMap.getIcon("atualizarComunidadejButton.icon")); // NOI18N
        atualizarComunidadejButton.setText(resourceMap.getString("atualizarComunidadejButton.text")); // NOI18N
        atualizarComunidadejButton.setName("atualizarComunidadejButton"); // NOI18N
        atualizarComunidadejButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                atualizarComunidadejButtonActionPerformed(evt);
            }
        });

        comunidadejComboBox.setName("comunidadejComboBox"); // NOI18N
        comunidadejComboBox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comunidadejComboBoxItemStateChanged(evt);
            }
        });

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        atualizarContajButton.setIcon(resourceMap.getIcon("atualizarContajButton.icon")); // NOI18N
        atualizarContajButton.setText(resourceMap.getString("atualizarContajButton.text")); // NOI18N
        atualizarContajButton.setName("atualizarContajButton"); // NOI18N
        atualizarContajButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                atualizarContajButtonActionPerformed(evt);
            }
        });

        contasjComboBox.setName("contasjComboBox"); // NOI18N
        contasjComboBox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                contasjComboBoxItemStateChanged(evt);
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        datLancjFormattedTextField.setFormatterFactory(Funcoes.setFormatoData());
        datLancjFormattedTextField.setText(resourceMap.getString("datLancjFormattedTextField.text")); // NOI18N
        datLancjFormattedTextField.setName("datLancjFormattedTextField"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        buttonGroup1.add(esteAnojRadioButton);
        esteAnojRadioButton.setText(resourceMap.getString("esteAnojRadioButton.text")); // NOI18N
        esteAnojRadioButton.setActionCommand(resourceMap.getString("esteAnojRadioButton.actionCommand")); // NOI18N
        esteAnojRadioButton.setName("esteAnojRadioButton"); // NOI18N
        esteAnojRadioButton.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                esteAnojRadioButtonItemStateChanged(evt);
            }
        });

        buttonGroup1.add(esteMesjRadioButton);
        esteMesjRadioButton.setText(resourceMap.getString("text")); // NOI18N
        esteMesjRadioButton.setActionCommand(resourceMap.getString("esteMesjRadioButton.actionCommand")); // NOI18N
        esteMesjRadioButton.setName(""); // NOI18N
        esteMesjRadioButton.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                esteMesjRadioButtonItemStateChanged(evt);
            }
        });

        buttonGroup1.add(hojejRadioButton);
        hojejRadioButton.setSelected(true);
        hojejRadioButton.setText(resourceMap.getString("hojejRadioButton.text")); // NOI18N
        hojejRadioButton.setActionCommand(resourceMap.getString("hojejRadioButton.actionCommand")); // NOI18N
        hojejRadioButton.setName("hojejRadioButton"); // NOI18N
        hojejRadioButton.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                hojejRadioButtonItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(datLancjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(contasjComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addComponent(atualizarContajButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(comunidadejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(atualizarComunidadejButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel3))
                .addGap(30, 30, 30)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(esteAnojRadioButton)
                    .addComponent(esteMesjRadioButton)
                    .addComponent(hojejRadioButton))
                .addContainerGap(68, Short.MAX_VALUE))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comunidadejComboBox, contasjComboBox});

        jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {esteAnojRadioButton, esteMesjRadioButton, hojejRadioButton});

        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(datLancjFormattedTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                                .addComponent(contasjComboBox, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE))
                            .addComponent(atualizarComunidadejButton)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comunidadejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(atualizarContajButton))
                .addGap(34, 34, 34))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(hojejRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(esteMesjRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(esteAnojRadioButton)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comunidadejComboBox, contasjComboBox});

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        gradeCaixajTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Código", "Historico", "Data", "Pessoa", "Valor"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        gradeCaixajTable.setName("gradeCaixajTable"); // NOI18N
        gradeCaixajTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                gradeCaixajTableMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(gradeCaixajTable);
        gradeCaixajTable.getColumnModel().getColumn(0).setPreferredWidth(80);
        gradeCaixajTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("gradeCaixajTable.columnModel.title0")); // NOI18N
        gradeCaixajTable.getColumnModel().getColumn(1).setPreferredWidth(250);
        gradeCaixajTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("gradeCaixajTable.columnModel.title1")); // NOI18N
        gradeCaixajTable.getColumnModel().getColumn(2).setPreferredWidth(80);
        gradeCaixajTable.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("gradeCaixajTable.columnModel.title4")); // NOI18N
        gradeCaixajTable.getColumnModel().getColumn(3).setPreferredWidth(200);
        gradeCaixajTable.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("gradeCaixajTable.columnModel.title2")); // NOI18N
        gradeCaixajTable.getColumnModel().getColumn(4).setPreferredWidth(100);
        gradeCaixajTable.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("gradeCaixajTable.columnModel.title3")); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5.setBackground(resourceMap.getColor("jPanel5.background")); // NOI18N
        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel5.setName("jPanel5"); // NOI18N

        saldoAtualjFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00"))));
        saldoAtualjFormattedTextField.setText(resourceMap.getString("saldoAtualjFormattedTextField.text")); // NOI18N
        saldoAtualjFormattedTextField.setName("saldoAtualjFormattedTextField"); // NOI18N

        totaljLabel1.setText(resourceMap.getString("totaljLabel1.text")); // NOI18N
        totaljLabel1.setName("totaljLabel1"); // NOI18N

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap(439, Short.MAX_VALUE)
                .addComponent(totaljLabel1)
                .addGap(18, 18, 18)
                .addComponent(saldoAtualjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(41, 41, 41))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(totaljLabel1)
                    .addComponent(saldoAtualjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(12, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("jPanel6.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel6.border.titleFont"), resourceMap.getColor("jPanel6.border.titleColor"))); // NOI18N
        jPanel6.setName("jPanel6"); // NOI18N

        totaljLabel2.setText(resourceMap.getString("totaljLabel2.text")); // NOI18N
        totaljLabel2.setName("totaljLabel2"); // NOI18N

        saldoAnteriorjFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00"))));
        saldoAnteriorjFormattedTextField.setText(resourceMap.getString("saldoAnteriorjFormattedTextField.text")); // NOI18N
        saldoAnteriorjFormattedTextField.setName("saldoAnteriorjFormattedTextField"); // NOI18N

        totaljFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00"))));
        totaljFormattedTextField.setText(resourceMap.getString("totaljFormattedTextField.text")); // NOI18N
        totaljFormattedTextField.setName("totaljFormattedTextField"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(228, Short.MAX_VALUE)
                .addComponent(totaljLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(saldoAnteriorjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel4)
                .addGap(18, 18, 18)
                .addComponent(totaljFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(saldoAnteriorjFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(totaljLabel2)
                    .addComponent(jLabel4)
                    .addComponent(totaljFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 701, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 539, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public ClassConecta conexao = new ClassConecta();

    ComboItem comboContas;
    ComboItem comboComunidade;
    public double valorTotal = 0;
     public ResultSet resultSet = null;
     public int codLanc;
     


    public void getGradeCaixa() throws ParseException, SQLException{

        LivroCaixa oLivroCaixa = new LivroCaixa();
        ComboItem comboConta = (ComboItem) contasjComboBox.getSelectedItem();
        ComboItem comboComunidades = (ComboItem) comunidadejComboBox.getSelectedItem();
        oLivroCaixa.setCodComunidade(comboComunidades.getId());
        oLivroCaixa.setCodConta(comboConta.getId());


         SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
        try {
            oLivroCaixa.setDataLanc((Date) formato.parse(datLancjFormattedTextField.getValue().toString()));
            oLivroCaixa.setDatFinal((Date) formato.parse(datLancjFormattedTextField.getValue().toString()));
        } catch (ParseException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }

        if (buttonGroup1.getSelection().getActionCommand().equals("Este Mês")){
           oLivroCaixa.setAnoRef( Funcoes.getYear(datLancjFormattedTextField.getText())  );
           oLivroCaixa.setMesRef( Funcoes.getMonth(datLancjFormattedTextField.getText()) );
           oLivroCaixa.setDataLanc(null);
           oLivroCaixa.setDatFinal(null);
        }

        if (buttonGroup1.getSelection().getActionCommand().equals("Este Ano")){
           oLivroCaixa.setAnoRef( Funcoes.getYear(datLancjFormattedTextField.getText())  );
           oLivroCaixa.setDataLanc(null);
           oLivroCaixa.setDatFinal(null);
        }

        ResultSet resultSetCaixa = null;

        String[] colunasTabela = new String[]{"Código", "Histórico","Data", "Pessoa", "Valor"};
        DefaultTableModel modeloTabela = new DefaultTableModel(null, colunasTabela) {

            @Override
            public boolean isCellEditable(int row, int col) {
                return false;
            }
        };
        gradeCaixajTable.setModel(modeloTabela);
        //Dimensionar colunas
        gradeCaixajTable.getColumnModel().getColumn(0).setPreferredWidth(80);
        gradeCaixajTable.getColumnModel().getColumn(0).setMaxWidth(80);

        gradeCaixajTable.getColumnModel().getColumn(1).setPreferredWidth(250);
        gradeCaixajTable.getColumnModel().getColumn(1).setMaxWidth(250);

        gradeCaixajTable.getColumnModel().getColumn(2).setPreferredWidth(80);
        gradeCaixajTable.getColumnModel().getColumn(2).setMaxWidth(80);

        gradeCaixajTable.getColumnModel().getColumn(3).setPreferredWidth(150);
        gradeCaixajTable.getColumnModel().getColumn(3).setMaxWidth(150);

        gradeCaixajTable.getColumnModel().getColumn(4).setPreferredWidth(80);
        gradeCaixajTable.getColumnModel().getColumn(4).setMaxWidth(80);
     try {
            resultSetCaixa = oLivroCaixa.getConsultar();
            resultSetCaixa.last(); //Atualiza o getRow
            if (resultSetCaixa.getRow() > 0){
              saldoAnteriorjFormattedTextField.setValue(oLivroCaixa.getConsultarSaldo("anterior",conexao));
              saldoAtualjFormattedTextField.setValue(oLivroCaixa.getConsultarSaldo("atual",conexao));
              totaljFormattedTextField.setValue(oLivroCaixa.getConsultarSaldo("saldo",conexao)+oLivroCaixa.getConsultarSaldo("anterior",conexao));
            }
            resultSetCaixa.beforeFirst();//Retorna o ponteiro para o inicio sem isso nao funciona a grade

        } catch (SQLException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }

        try {
            while (resultSetCaixa.next()) {

                //Formatar valor
                DecimalFormat formatoMoney = new DecimalFormat("###,###,##0.00");
                String oValorDoc = null;
                oValorDoc = formatoMoney.format(resultSetCaixa.getFloat("valor"));
                
                Date dataPagamento = resultSetCaixa.getDate("dataLanc");
                String dataLanc = null;
                if (dataPagamento != null){
                SimpleDateFormat formatoDataLanc = new SimpleDateFormat("dd/MM/yyyy");
                dataLanc = formatoDataLanc.format(dataPagamento);
                }else{
                dataLanc = "";
                }
                //Fim formatação

                modeloTabela.addRow(new String[]{
                    Funcoes.getZeroEsq(resultSetCaixa.getInt("codLanc"), 8),
                    resultSetCaixa.getString("historico"),
                    dataLanc,
                    resultSetCaixa.getString("pessoa"),
                    oValorDoc
                });

            }
        } catch (SQLException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void sairjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sairjButtonActionPerformed
        // TODO add your handling code here:
        this.dispose();
}//GEN-LAST:event_sairjButtonActionPerformed

    private void depositojButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_depositojButtonActionPerformed
        // TODO add your handling code here:
        jFOperacao oFormOperacao    = new jFOperacao();
        oFormOperacao.conexao       = conexao;
        oFormOperacao.operacao      = 0  ;
        oFormOperacao.tipoRepasse   = "Dinheiro";
        oFormOperacao.valorCheque   = 0;
        oFormOperacao.setTitle("Depósito");

        oFormOperacao.pack();
        oFormOperacao.setLocationRelativeTo(null);
        oFormOperacao.setModal(true);
        oFormOperacao.setVisible(true);
        consultarLancamentojButtonActionPerformed(evt);
    }//GEN-LAST:event_depositojButtonActionPerformed

    private void saquejButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saquejButtonActionPerformed
        // TODO add your handling code here:
        jFOperacao oFormOperacao = new jFOperacao();
        oFormOperacao.conexao       = conexao;
        oFormOperacao.operacao = 1;
        oFormOperacao.tipoRepasse = "Dinheiro";
        oFormOperacao.valorCheque = 0;
        oFormOperacao.setTitle("Saque");

        oFormOperacao.pack();
        oFormOperacao.setLocationRelativeTo(null);
        oFormOperacao.setModal(true);
        oFormOperacao.setVisible(true);
        consultarLancamentojButtonActionPerformed(evt);
    }//GEN-LAST:event_saquejButtonActionPerformed

    private void transferenciajButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_transferenciajButtonActionPerformed
        // TODO add your handling code here:
        jFOperacao oFormOperacao = new jFOperacao();
        oFormOperacao.conexao       = conexao;
        oFormOperacao.operacao   = 2   ;
        oFormOperacao.tipoRepasse   = "Dinheiro";
        oFormOperacao.valorCheque   = 0;
        oFormOperacao.setTitle("Transferência");


        oFormOperacao.pack();
        oFormOperacao.setLocationRelativeTo(null);
        oFormOperacao.setModal(true);
        oFormOperacao.setVisible(true);
        consultarLancamentojButtonActionPerformed(evt);
    }//GEN-LAST:event_transferenciajButtonActionPerformed

    private void atualizarComunidadejButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_atualizarComunidadejButtonActionPerformed
        // TODO add your handling code here:
        try {
            Comunidade oComunidade = new Comunidade();
            ResultSet rs = null;
            rs = oComunidade.getConsultar();
            comunidadejComboBox.removeAllItems();
            while (rs.next()) {
                comunidadejComboBox.addItem(new ComboItem(rs.getInt(1), rs.getString(2)));
            }
            comunidadejComboBox.updateUI();
        } catch (SQLException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_atualizarComunidadejButtonActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:

        URL arquivo = getClass().getResource("igreja.png");
        setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(arquivo));

        ClassConecta.conecta();
        SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
        Date dataLanc = new Date();
        String datAtual = null;
        Calendar calendar = Calendar.getInstance();
        dataLanc = calendar.getTime();
        datAtual = formato.format(dataLanc);
        datLancjFormattedTextField.setValue(datAtual );

        
        atualizarComunidadejButtonActionPerformed(null);
        atualizarContajButtonActionPerformed(null);
        consultarLancamentojButtonActionPerformed(null);
        try {
            datLancjFormattedTextField.setText(Funcoes.getNowBR());
        } catch (ParseException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        } 
    }//GEN-LAST:event_formWindowOpened

    private void atualizarContajButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_atualizarContajButtonActionPerformed
        // TODO add your handling code here:
                try {
            Contas oConta = new Contas();
            ResultSet rs = null;
            rs = oConta.getConsultarContas();
            contasjComboBox.removeAllItems();
            while (rs.next()) {
                contasjComboBox.addItem(new ComboItem(rs.getInt("codConta"), rs.getString("banco")));
            }
            contasjComboBox.updateUI();
        } catch (SQLException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_atualizarContajButtonActionPerformed

    private void consultarLancamentojButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_consultarLancamentojButtonActionPerformed
        try {
            getGradeCaixa();
        } catch (ParseException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_consultarLancamentojButtonActionPerformed

    private void contasjComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_contasjComboBoxItemStateChanged
        // TODO add your handling code here:
        if (comunidadejComboBox.getSelectedItem() == null){

        }else{
        consultarLancamentojButtonActionPerformed(null);
        }
    }//GEN-LAST:event_contasjComboBoxItemStateChanged

    private void abriCaixajButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abriCaixajButtonActionPerformed
        // TODO add your handling code here:
        try {
           //Confirmar

            Object[] options = {"Sim", "Não"};
            int sd = JOptionPane.showOptionDialog(null, "Deseja realmente ABRIR o caixa de " + datLancjFormattedTextField.getText() + " ?", "Confirmação!", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
            if (sd != 0) {
                return;
            }

            ComboItem codConta = (ComboItem) contasjComboBox.getSelectedItem();
            ComboItem codPessoa = (ComboItem) comunidadejComboBox.getSelectedItem();
            ComboItem codComunidade = (ComboItem) comunidadejComboBox.getSelectedItem();
            Funcoes.setLancContabil(conexao, datLancjFormattedTextField.getText(), codComunidade.getId(), codConta.getId(), 0, codPessoa.getId(), "Abertura", "de Caixa", (double) 0.0, "Abertura Caixa");
            consultarLancamentojButtonActionPerformed(null);


        } catch (SQLException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ParseException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }




       
    }//GEN-LAST:event_abriCaixajButtonActionPerformed

    private void estornarLancjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_estornarLancjButtonActionPerformed
        // TODO add your handling code here:
 //Confirmar
        Object[] options = {"Sim", "Não"};
        int sd =
                JOptionPane.showOptionDialog(
                null,
                "Deseja realmente ESTORNAR este lançamento ?",
                "Confirmação!",
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.WARNING_MESSAGE,
                null,
                options,
                options[0]);

        if (sd != 0) {
            return;
        }
        LivroCaixa oLivro   = new LivroCaixa();
        oLivro.setCodLanc(codLanc);
        oLivro.setEstornar(conexao);
        try {
            ClassConecta.con.commit();
        } catch (SQLException ex) {
            Logger.getLogger(jFCaixa.class.getName()).log(Level.SEVERE, null, ex);
        }
        consultarLancamentojButtonActionPerformed(null);
    }//GEN-LAST:event_estornarLancjButtonActionPerformed

    private void hojejRadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_hojejRadioButtonItemStateChanged
        // TODO add your handling code here:
        consultarLancamentojButtonActionPerformed(null);
    }//GEN-LAST:event_hojejRadioButtonItemStateChanged

    private void esteMesjRadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_esteMesjRadioButtonItemStateChanged
        // TODO add your handling code here:
        consultarLancamentojButtonActionPerformed(null);
    }//GEN-LAST:event_esteMesjRadioButtonItemStateChanged

    private void esteAnojRadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_esteAnojRadioButtonItemStateChanged
        // TODO add your handling code here:
        consultarLancamentojButtonActionPerformed(null);
    }//GEN-LAST:event_esteAnojRadioButtonItemStateChanged

    private void gradeCaixajTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_gradeCaixajTableMouseClicked
        // TODO add your handling code here:
        codLanc = Integer.parseInt(gradeCaixajTable.getValueAt(gradeCaixajTable.getSelectedRow(), 0).toString());
        if (codLanc > 0){
            estornarLancjButton.setEnabled(true);
        }else{
            estornarLancjButton.setEnabled(false);
        }
    }//GEN-LAST:event_gradeCaixajTableMouseClicked

    private void comunidadejComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comunidadejComboBoxItemStateChanged
        // TODO add your handling code here:
        if (contasjComboBox.getSelectedItem() == null){

        }else{
        consultarLancamentojButtonActionPerformed(null);
        }
    }//GEN-LAST:event_comunidadejComboBoxItemStateChanged

    private void imprimirjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imprimirjButtonActionPerformed
        // TODO add your handling code here:
        jFRLivroCaixa oRLivroCaixa = new jFRLivroCaixa();
        oRLivroCaixa.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        oRLivroCaixa.pack();
        oRLivroCaixa.saldoAnterior    = Double.parseDouble(saldoAnteriorjFormattedTextField.getValue().toString());
        oRLivroCaixa.saldoDisponivel  = Double.parseDouble(totaljFormattedTextField.getValue().toString());
        oRLivroCaixa.setLocationRelativeTo(null);
        oRLivroCaixa.setVisible(true);
    }//GEN-LAST:event_imprimirjButtonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new jFCaixa().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton abriCaixajButton;
    private javax.swing.JButton atualizarComunidadejButton;
    private javax.swing.JButton atualizarContajButton;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox comunidadejComboBox;
    private javax.swing.JButton consultarLancamentojButton;
    private javax.swing.JComboBox contasjComboBox;
    private javax.swing.JFormattedTextField datLancjFormattedTextField;
    private javax.swing.JButton depositojButton;
    private javax.swing.JRadioButton esteAnojRadioButton;
    private javax.swing.JRadioButton esteMesjRadioButton;
    private javax.swing.JButton estornarLancjButton;
    private javax.swing.JTable gradeCaixajTable;
    private javax.swing.JRadioButton hojejRadioButton;
    private javax.swing.JButton imprimirjButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JButton sairjButton;
    private javax.swing.JFormattedTextField saldoAnteriorjFormattedTextField;
    private javax.swing.JFormattedTextField saldoAtualjFormattedTextField;
    private javax.swing.JButton saquejButton;
    private javax.swing.JFormattedTextField totaljFormattedTextField;
    private javax.swing.JLabel totaljLabel1;
    private javax.swing.JLabel totaljLabel2;
    private javax.swing.JButton transferenciajButton;
    // End of variables declaration//GEN-END:variables

}
